<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>基于windows的Hexo博客的搭建和配置 | XiaoZiYan</title><meta name="keywords" content="hexo"><meta name="author" content="XiaoZiYan"><meta name="copyright" content="XiaoZiYan"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="基于windows平台，使用Hexo+gitee+typora+Picgo搭建一个属于自己的博客">
<meta property="og:type" content="article">
<meta property="og:title" content="基于windows的Hexo博客的搭建和配置">
<meta property="og:url" content="https://xiaoziyanxiaoludan.gitee.io/xiaoziyan/2019/08/17/Hexo%E5%8D%9A%E5%AE%A2%E7%9A%84%E6%90%AD%E5%BB%BA%E5%92%8C%E9%85%8D%E7%BD%AE/index.html">
<meta property="og:site_name" content="XiaoZiYan">
<meta property="og:description" content="基于windows平台，使用Hexo+gitee+typora+Picgo搭建一个属于自己的博客">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://xiaoziyanxiaoludan.gitee.io/xiaoziyan/2019/08/17/Hexo%E5%8D%9A%E5%AE%A2%E7%9A%84%E6%90%AD%E5%BB%BA%E5%92%8C%E9%85%8D%E7%BD%AE/b.jpg">
<meta property="article:published_time" content="2019-08-17T10:51:32.000Z">
<meta property="article:modified_time" content="2022-11-03T10:21:28.981Z">
<meta property="article:author" content="XiaoZiYan">
<meta property="article:tag" content="hexo">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://xiaoziyanxiaoludan.gitee.io/xiaoziyan/2019/08/17/Hexo%E5%8D%9A%E5%AE%A2%E7%9A%84%E6%90%AD%E5%BB%BA%E5%92%8C%E9%85%8D%E7%BD%AE/b.jpg"><link rel="shortcut icon" href="/xiaoziyan/img/favicon.png"><link rel="canonical" href="https://xiaoziyanxiaoludan.gitee.io/xiaoziyan/2019/08/17/Hexo%E5%8D%9A%E5%AE%A2%E7%9A%84%E6%90%AD%E5%BB%BA%E5%92%8C%E9%85%8D%E7%BD%AE/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><meta/><link rel="stylesheet" href="/xiaoziyan/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/xiaoziyan/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":50,"languages":{"author":"作者: XiaoZiYan","link":"链接: ","source":"来源: XiaoZiYan","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#121212","position":"bottom-left"},
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: true,
  islazyload: false,
  isanchor: true
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '基于windows的Hexo博客的搭建和配置',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2022-11-03 18:21:28'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if (GLOBAL_CONFIG_SITE.isHome && /iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><link rel="stylesheet" href="./css/custom.css" media="defer" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css"><!-- hexo injector head_end start --><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/hexo-electric-clock@1.0.6/clock.css"><!-- hexo injector head_end end --><meta name="generator" content="Hexo 5.4.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/xiaoziyan/img/avatar.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/xiaoziyan/archives/"><div class="headline">文章</div><div class="length-num">33</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/xiaoziyan/tags/"><div class="headline">标签</div><div class="length-num">41</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/xiaoziyan/categories/"><div class="headline">分类</div><div class="length-num">39</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/xiaoziyan/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/xiaoziyan/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/xiaoziyan/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/xiaoziyan/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 多媒体</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/xiaoziyan/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/xiaoziyan/movies/"><i class="fa-fw fas fa-video"></i><span> 视频</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/xiaoziyan/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/xiaoziyan/about/"><i class="fa-fw fas fa-heart"></i><span> 关于我</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('/xiaoziyan/2019/08/17/Hexo%E5%8D%9A%E5%AE%A2%E7%9A%84%E6%90%AD%E5%BB%BA%E5%92%8C%E9%85%8D%E7%BD%AE/b.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/xiaoziyan/">XiaoZiYan</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/xiaoziyan/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/xiaoziyan/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/xiaoziyan/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/xiaoziyan/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 多媒体</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/xiaoziyan/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/xiaoziyan/movies/"><i class="fa-fw fas fa-video"></i><span> 视频</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/xiaoziyan/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/xiaoziyan/about/"><i class="fa-fw fas fa-heart"></i><span> 关于我</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">基于windows的Hexo博客的搭建和配置</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2019-08-17T10:51:32.000Z" title="发表于 2019-08-17 18:51:32">2019-08-17</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2022-11-03T10:21:28.981Z" title="更新于 2022-11-03 18:21:28">2022-11-03</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/xiaoziyan/categories/Hexo/">Hexo</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/xiaoziyan/categories/Hexo/%E6%95%99%E7%A8%8B/">教程</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/xiaoziyan/categories/Hexo/%E6%95%99%E7%A8%8B/Hexo%E5%8D%9A%E5%AE%A2%E7%9A%84%E4%BD%BF%E7%94%A8/">Hexo博客的使用</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="基于windows的Hexo博客的搭建和配置"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h3 id="Hexo安装必备软件-node-js-、git-这里再windows沙盒演示"><a href="#Hexo安装必备软件-node-js-、git-这里再windows沙盒演示" class="headerlink" title="Hexo安装必备软件 node.js 、git 这里再windows沙盒演示"></a>Hexo安装必备软件 node.js 、git 这里再windows沙盒演示</h3><h4 id="node-js安装"><a href="#node-js安装" class="headerlink" title="node.js安装"></a>node.js安装</h4><p>​    进入node.js官网，下载相应的版本，<a target="_blank" rel="noopener" href="https://nodejs.org/zh-cn/">node.js官网</a></p>
<p><img src="http://xiaoziyan.top/images/image-20210925080402043.png" alt="node.js官网"></p>
<p>​    在官网选择稳定版下载会好一点，安装过程就选择相应的存储位置，一直下一步就可以了。</p>
<p><img src="http://xiaoziyan.top/images/image-20210925082150399.png" alt="node.js安装"></p>
<p>​    接着<code>win+R</code>，输入cmd调出命令行输入<code>node -v</code> 测试一下node.js是否安装成功，出现版本号就是成功。</p>
<p><img src="http://xiaoziyan.top/images/image-20210925082509854.png" alt="出现版本号，安装成功"></p>
<h4 id="git的安装"><a href="#git的安装" class="headerlink" title="git的安装"></a>git的安装</h4><p>​    和node.js一样进入官网下载，<a target="_blank" rel="noopener" href="https://git-scm.com/">git官网链接</a></p>
<p><img src="http://xiaoziyan.top/images/image-20210925082638849.png" alt="git官网"></p>
<p>​    安装过程也是一直下一步就好，安装完成之后在空白处右键，出现下图的样式就是安装成功。</p>
<p><img src="http://xiaoziyan.top/images/image-20210925083647664.png" alt="右键的出现gitGUI和gitBash"></p>
<p>​    也可以使用命令行测试，输入<code>git -v</code></p>
<p><img src="http://xiaoziyan.top/images/image-20210925083825330.png" alt="git -v命令"></p>
<h3 id="全局安装Hexo"><a href="#全局安装Hexo" class="headerlink" title="全局安装Hexo"></a>全局安装Hexo</h3><p>​    在命令行操作，输入下面npm命令，（npm即为Node.js环境，如z果卡顿推荐使用<a target="_blank" rel="noopener" href="https://www.jianshu.com/p/ad58bbcede05">cnpm</a>）</p>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-cli -g</span><br></pre></td></tr></table></figure>

<p><img src="http://xiaoziyan.top/images/image-20210925084836956.png" alt="hexo全局安装"></p>
<p><img src="http://xiaoziyan.top/images/image-20210925085908720.png" alt="安装成功"></p>
<p>​    在你想要创建一个文件夹，名字自己取，尽量取中文名，这里取名<code>blog</code>。进入blog文件夹，在上方的地址栏输入cmd即可在命令行模式下进入该目录。</p>
<p><img src="http://xiaoziyan.top/images/image-20210925085212112.png" alt="进入blog目录"></p>
<h3 id="初始化Hexo博客"><a href="#初始化Hexo博客" class="headerlink" title="初始化Hexo博客"></a>初始化Hexo博客</h3><p>​    命令行进入该目录之后，输入下面命令初始化博客，后面所有操作都是基于这个文件夹，如果出错就把文件夹删掉重来就行。</p>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo init</span><br></pre></td></tr></table></figure>

<p><img src="http://xiaoziyan.top/images/image-20210925085829925.png" alt="安装成功"></p>
<p>​    可以看到blog文件夹已经多了很多文件</p>
<p><img src="http://xiaoziyan.top/images/image-20210925090348768.png" alt="image-20210925090348768"></p>
<h3 id="本地运行博客"><a href="#本地运行博客" class="headerlink" title="本地运行博客"></a>本地运行博客</h3><p>​    这个时候blog目录就可以叫做博客的根目录，在博客根目录下打开命令行，输入<code>hexo -s</code> 即可运行博客。</p>
<p><img src="http://xiaoziyan.top/images/image-20210925090646618.png" alt="运行成功"></p>
<p>​    打开浏览器输入<a href="localhost:4000">localhost:4000</a> （127.0.0.1:4000效果一样）进入博客主页，就这样一个Hexo博客就在本地建好了。</p>
<p><img src="http://xiaoziyan.top/images/image-20210925091003496.png" alt="localhost:4000"></p>
<p>​    下面是博客常用的命令</p>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">hexo clean     				 #清理博客缓存 hexo -cl简写也可，下面也一样</span><br><span class="line">hexo g         				 #编译博客</span><br><span class="line">hexo s         		 		 #本地运行博客</span><br><span class="line">hexo d         				 #将博客推送到服务器</span><br><span class="line">hexo new page tags 			 #创建新的标签页</span><br><span class="line">hexo new &quot;这是我的一篇文章&quot;		#创建一篇文章</span><br><span class="line"></span><br><span class="line">#当然，除了单独输入命令也可以使用 &quot;&amp;&amp;&quot; 实现一键三连</span><br><span class="line">hexo cl &amp;&amp; hexo g &amp;&amp; hexo s</span><br><span class="line">hexo cl &amp;&amp; hexo g &amp;&amp; hexo d</span><br></pre></td></tr></table></figure>

<hr>
<h3 id="把博客部署到云端"><a href="#把博客部署到云端" class="headerlink" title="把博客部署到云端"></a>把博客部署到云端</h3><p>​    因为github最近不太稳定，有时候进不去，所以这里使用的是码云<a target="_blank" rel="noopener" href="https://gitee.com/">gitee</a>，码云功能类似githuub，操作流程也一致。</p>
<h4 id="创建码云账号"><a href="#创建码云账号" class="headerlink" title="创建码云账号"></a>创建码云账号</h4><p>​    创建账号就不演示了，这个谁都会，额外需要注意的是需要实名认证，不然后面无法使用Pages服务，就不能部署静态网页，后面访问要用。</p>
<p><img src="http://xiaoziyan.top/images/image-20210925093547570.png" alt="Pages服务"></p>
<h4 id="新建仓库"><a href="#新建仓库" class="headerlink" title="新建仓库"></a>新建仓库</h4><p>​    <strong>注意：仓库名称和路径尽量和用户名一样，并且尽量是英文，不然推送过程可能会有各种想不到的麻烦，别问我怎么知道的。</strong></p>
<p><img src="http://xiaoziyan.top/images/image-20210925094125980.png" alt="新建仓库"></p>
<h4 id="创建自己的密钥"><a href="#创建自己的密钥" class="headerlink" title="创建自己的密钥"></a>创建自己的密钥</h4><p>​    先不要初始化仓库，使用他提供的命令创建自己的密钥，除了这两条命令还有一条创建密钥的命令。如下面命令所示。</p>
<p><img src="http://xiaoziyan.top/images/image-20210925095416991.png" alt="gitee初始化仓库页面"></p>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">#创建密钥命令，在全局打开<span class="built_in">cmd</span>就可以</span><br><span class="line"></span><br><span class="line">git config --global user.name &quot;用户名&quot;</span><br><span class="line">git config --global user.email &quot;用户邮箱&quot;</span><br><span class="line">ssh-keygen -t rsa -C &quot;用户邮箱&quot;</span><br><span class="line"></span><br><span class="line">#如下图创建成功后就可以点击上图中的“初始化readme文件”进入仓库了</span><br></pre></td></tr></table></figure>

<p><img src="http://xiaoziyan.top/images/image-20210925095901330.png" alt="创建过程"></p>
<p>​    进入自己的<code>C:\Users\你的电脑用户名\.ssh</code>  ，操作流程为，C盘→用户→电脑用户名，看自己的→.ssh。进去会看到一个<code>id_rsa.pub</code>文件，如果看不到后缀名，就在查看里面打开文件后缀显示。接着用记事本打开该文件，复制里面的内容。在码云的设置→SSH公钥→新建SSH公钥，如下图所示。</p>
<p><img src="http://xiaoziyan.top/images/image-20210925100708918.png" alt="密钥文件"></p>
<p><img src="http://xiaoziyan.top/images/image-20210925101114174.png" alt="新建公钥"></p>
<h4 id="配置博客配置文件-config-yml"><a href="#配置博客配置文件-config-yml" class="headerlink" title="配置博客配置文件_config.yml"></a>配置博客配置文件_config.yml</h4><figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#文件上部的URL配置</span></span><br><span class="line"><span class="attr">url:</span> <span class="string">https://username.github.io/projec</span>	 <span class="comment">#自己的Pages服务地址，别照抄</span></span><br><span class="line"><span class="attr">root:</span> <span class="string">/test/</span>							 <span class="comment">#test为自己的仓库名字，如果没有root那就新建一个</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#在底部的deploy:下面新建几个属性</span></span><br><span class="line"><span class="attr">deploy:</span></span><br><span class="line">  <span class="attr">type:</span> <span class="string">git</span>                              <span class="comment">#类型选git</span></span><br><span class="line">  <span class="attr">repo:</span> <span class="string">git@gitee.com:username/test.git</span>  <span class="comment">#这里是自己的gitee下载地址,选择SSH下载</span></span><br><span class="line">  <span class="attr">branch:</span> <span class="string">master</span>						 <span class="comment">#主线，默认master</span></span><br></pre></td></tr></table></figure>

<p><img src="http://xiaoziyan.top/images/image-20210925102753427.png" alt="repo属性该填的地址"></p>
<p>​    配置完成后就在博客根目录使用三连命令<code>hexo cl &amp;&amp; hexo g &amp;&amp; hexo d</code>将博客推送到码云 。</p>
<p><img src="http://xiaoziyan.top/images/image-20210925103628749.png" alt="推送成功"></p>
<h4 id="部署自己的博客到公网"><a href="#部署自己的博客到公网" class="headerlink" title="部署自己的博客到公网"></a>部署自己的博客到公网</h4><p>​    在仓库页面选择服务→<code>Gitee Pages</code>服务，开启即可，部署完成就可以看到自己的链接了。</p>
<p><img src="http://xiaoziyan.top/images/image-20210925104038730.png" alt="page服务"></p>
<p>​    点击网站进去自己的网站，这样整个博客就部署完成了，当然这才是博客搭建的第一步，还需要写文章，主题美化，照片图床等。后面将推出更多教程。</p>
<p><img src="http://xiaoziyan.top/images/image-20210925104345779.png" alt="部署完成"></p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">XiaoZiYan</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://xiaoziyanxiaoludan.gitee.io/xiaoziyan/2019/08/17/Hexo%E5%8D%9A%E5%AE%A2%E7%9A%84%E6%90%AD%E5%BB%BA%E5%92%8C%E9%85%8D%E7%BD%AE/">https://xiaoziyanxiaoludan.gitee.io/xiaoziyan/2019/08/17/Hexo%E5%8D%9A%E5%AE%A2%E7%9A%84%E6%90%AD%E5%BB%BA%E5%92%8C%E9%85%8D%E7%BD%AE/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://xiaoziyanxiaoludan.gitee.io/xiaoziyan" target="_blank">XiaoZiYan</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/xiaoziyan/tags/hexo/">hexo</a></div><div class="post_share"><div class="social-share" data-image="/xiaoziyan/2019/08/17/Hexo%E5%8D%9A%E5%AE%A2%E7%9A%84%E6%90%AD%E5%BB%BA%E5%92%8C%E9%85%8D%E7%BD%AE/b.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-full"><a href="/xiaoziyan/2019/08/17/git%E7%9A%84%E6%97%A5%E5%B8%B8%E4%BD%BF%E7%94%A8/"><img class="prev-cover" src="http://xiaoziyan.top/images/ce428855b8ca3bf6d66c2ce50815f449.jpeg" onerror="onerror=null;src='/xiaoziyan/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">git的日常使用</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/xiaoziyan/2019/08/17/Hexo%E5%8D%9A%E5%AE%A2%E5%A4%96%E6%8C%82%E8%BF%9E%E6%8E%A5/" title="Hexo博客外挂连接"><img class="cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2019-08-17</div><div class="title">Hexo博客外挂连接</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#Hexo%E5%AE%89%E8%A3%85%E5%BF%85%E5%A4%87%E8%BD%AF%E4%BB%B6-node-js-%E3%80%81git-%E8%BF%99%E9%87%8C%E5%86%8Dwindows%E6%B2%99%E7%9B%92%E6%BC%94%E7%A4%BA"><span class="toc-number">1.</span> <span class="toc-text">Hexo安装必备软件 node.js 、git 这里再windows沙盒演示</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#node-js%E5%AE%89%E8%A3%85"><span class="toc-number">1.1.</span> <span class="toc-text">node.js安装</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#git%E7%9A%84%E5%AE%89%E8%A3%85"><span class="toc-number">1.2.</span> <span class="toc-text">git的安装</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%85%A8%E5%B1%80%E5%AE%89%E8%A3%85Hexo"><span class="toc-number">2.</span> <span class="toc-text">全局安装Hexo</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%88%9D%E5%A7%8B%E5%8C%96Hexo%E5%8D%9A%E5%AE%A2"><span class="toc-number">3.</span> <span class="toc-text">初始化Hexo博客</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9C%AC%E5%9C%B0%E8%BF%90%E8%A1%8C%E5%8D%9A%E5%AE%A2"><span class="toc-number">4.</span> <span class="toc-text">本地运行博客</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%8A%8A%E5%8D%9A%E5%AE%A2%E9%83%A8%E7%BD%B2%E5%88%B0%E4%BA%91%E7%AB%AF"><span class="toc-number">5.</span> <span class="toc-text">把博客部署到云端</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E7%A0%81%E4%BA%91%E8%B4%A6%E5%8F%B7"><span class="toc-number">5.1.</span> <span class="toc-text">创建码云账号</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%96%B0%E5%BB%BA%E4%BB%93%E5%BA%93"><span class="toc-number">5.2.</span> <span class="toc-text">新建仓库</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E8%87%AA%E5%B7%B1%E7%9A%84%E5%AF%86%E9%92%A5"><span class="toc-number">5.3.</span> <span class="toc-text">创建自己的密钥</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE%E5%8D%9A%E5%AE%A2%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6-config-yml"><span class="toc-number">5.4.</span> <span class="toc-text">配置博客配置文件_config.yml</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%83%A8%E7%BD%B2%E8%87%AA%E5%B7%B1%E7%9A%84%E5%8D%9A%E5%AE%A2%E5%88%B0%E5%85%AC%E7%BD%91"><span class="toc-number">5.5.</span> <span class="toc-text">部署自己的博客到公网</span></a></li></ol></li></ol></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2022 By XiaoZiYan</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text"><p><a style="margin-inline:5px"target="_blank" href="https://hexo.io/"> <img src="https://img.shields.io/badge/Frame-Hexo-blue?style=flat&logo=hexo" title="博客框架为 Hexo" alt="HEXO"></a><a style="margin-inline:5px"target="_blank"href="https://butterfly.js.org/"> <img src="https://img.shields.io/badge/Theme-Butterfly-6513df?style=flat&logo=bitdefender" title="主题采用 Butterfly" alt="Butterfly"></a><a style="margin-inline:5px"target="_blank" href="https://www.jsdelivr.com/"> <img src="https://img.shields.io/badge/CDN-jsDelivr-orange?style=flat&logo=jsDelivr" title="本站使用 Jsdelivr 为静态资源提供CDN加速" alt="Jsdelivr"></a><a style="margin-inline:5px"target="_blank" href="https://github.com/"> <img src="https://img.shields.io/badge/Source-gitee-d021d6?style=flat&logo=Gitee" title="本站项目由 Gitee 托管" alt="Gitee"></a><a style="margin-inline:5px"target="_blank"href="http://creativecommons.org/licenses/by-nc-sa/4.0/"> <img src="https://img.shields.io/badge/Copyright-BY--NC--SA%204.0-d42328?style=flat&logo=Claris" alt="img" title="本站采用知识共享署名-非商业性使用-相同方式共享4.0国际许可协议进行许可"></a></p></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/xiaoziyan/js/utils.js"></script><script src="/xiaoziyan/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script>function panguFn () {
  if (typeof pangu === 'object') pangu.autoSpacingPage()
  else {
    getScript('https://cdn.jsdelivr.net/npm/pangu/dist/browser/pangu.min.js')
      .then(() => {
        pangu.autoSpacingPage()
      })
  }
}

function panguInit () {
  if (false){
    GLOBAL_CONFIG_SITE.isPost && panguFn()
  } else {
    panguFn()
  }
}

document.addEventListener('DOMContentLoaded', panguInit)</script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"></div><script src="./js/sakura.js"></script><canvas class="fireworks" mobile="false"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/fireworks.min.js"></script><script defer="defer" id="ribbon" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-ribbon.min.js" size="150" alpha="0.6" zIndex="-1" mobile="false" data-click="true"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><!-- hexo injector body_end start --><script data-pjax>function electric_clock_injector_config(){
                var parent_div_git = document.getElementsByClassName('sticky_layout')[0];
                var item_html = '<div class="card-widget card-clock"><div class="card-glass"><div class="card-background"><div class="card-content"><div id="hexo_electric_clock"><img id="card-clock-loading" src="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-clock/clock/images/weather/loading.gif" style="height: 120px; width: 100%;" data-ll-status="loading" class="entered loading"></div></div></div></div></div>';
                console.log('已挂载electric_clock')
                // parent_div_git.innerHTML=item_html+parent_div_git.innerHTML // 无报错，但不影响使用(支持pjax跳转)
                parent_div_git.insertAdjacentHTML("afterbegin",item_html) // 有报错，但不影响使用(支持pjax跳转)
            }if( document.getElementsByClassName('sticky_layout')[0] && (location.pathname ==='all'|| 'all' ==='all')){

            electric_clock_injector_config()
        } </script><script src="https://pv.sohu.com/cityjson?ie=utf-8"></script><script data-pjax  src="https://cdn.jsdelivr.net/gh/Zfour/hexo-electric-clock@1.0.6/clock.js"></script><!-- hexo injector body_end end --></body></html>